﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Portal.Nhibernate.Repository;

namespace Portal.Web.Admin.Article
{
    public partial class GetNewsJson : BasePage
    {
        private readonly IArticleRepository<IArticle> _articleRepository;

        public GetNewsJson()
        {
            _articleRepository = new ArticleRepository();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            Json(_articleRepository.Get(o => o.CategoryId == ((int)CategoryArticleEnum.News).ToString(CultureInfo.InvariantCulture)).Sorting(sort, order).Select(o => new Portal.Article { Id = o.Id, CreateTime = o.CreateTime, MainTitle = o.MainTitle, NormalImage = o.NormalImage, SmallImage = o.SmallImage, Culture = o.Culture }).JqEasyuiDataGrid(page, rows));
        }
    }
}